// house_pkg/pages/building/index.ts
Page({

  /**
   * 页面的初始数据
   */
  data: {
    
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(e) {
    //获取小区名字
    this.setData({
      Apartment:e.Apartment
    })
    this.createHouse(e.Apartment)
  },
  //生成随机数量的楼数组,小于9
  createHouse(name){
    //楼宇数组
    const houseList = []
    const houseNum = Math.floor(Math.random()*8+1)
    for (let index = 1; index <= houseNum; index++) {
      houseList.push(`${index}号楼${index}单元`)
    }
    this.setData({
      houseList
    })
  }
})